import org.apache.kylin.jdbc.Driver;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;

public class KylinConn {
    public static void main(String[] args) throws Exception {
        Driver driver = (Driver) Class.forName("org.apache.kylin.jdbc.Driver").newInstance();
        Properties info = new Properties();
        info.put("user", "ADMIN");
        info.put("password", "KYLIN");
        long start = System.currentTimeMillis();
        Connection conn = driver.connect("jdbc:kylin://192.168.0.83:7070/Test", info);
        System.err.println(System.currentTimeMillis() - start);
        Statement state = conn.createStatement();
        ResultSet result = state.executeQuery("select log_module,count(1) \n" +
                "from viewt2 where \n" +
                "create_date>=20180801 and week=2 group by log_module;");
        while (result.next()){
            System.out.println(result.getString(1));;
            System.out.println(result.getString(2));;
        }
        System.out.println(System.currentTimeMillis() - start);
    }
}
